package data;

import com.EntityName;
import com.google.appengine.api.datastore.Entity;


public class CleaningStatus extends AbstractData {
	private long id = -1;
	private long hotelId;
	private String title;
	private String color;
	
	public CleaningStatus(){}
	
	public CleaningStatus(long id)
	{
		this.id = id;
	}
	@Override
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}

	public long getHotelId() {
		return hotelId;
	}

	public void setHotelId(long hotelId) {
		this.hotelId = hotelId;
	}	
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	@Override
	public Entity getEntity() {
		Entity item;
		if(this.key == null)
			item = new Entity(EntityName.CleaningStatus);
		else
			item = new Entity(this.key);

		item.setProperty("hotelId", this.hotelId);
		item.setProperty("title", this.title);
		item.setProperty("color", this.color);
		return item;
	}
	@Override
	public void setEntity(Entity entity) {
		this.id = entity.getKey().getId();
		this.hotelId = (Long) entity.getProperty("hotelId");
		this.title = (String) entity.getProperty("title");
		this.color = (String) entity.getProperty("color");
		this.key = entity.getKey();
	}

	public void LoadData() {
		if (this.id > -1) {
			Entity entity = LoadData(EntityName.CleaningStatus, this.id);
			setEntity(entity);
		}
	}

}
